import service,{ baseURL } from './index';
import { ICourseTableParams, ICoSelectedParams, ICourseOneParams, ICoursePageParams, ITchCoYearParams, IUpadteCourseColorParams, ITodayCourseParams } from '../type';

export const course = {
  fileImportUrl: `${baseURL}/course/fileImport`,
  fileExportUrl: `${baseURL}/course/fileExport`,
  findAllCourseSchoolYear: () => {
    return service({
      url: '/course/findAllCourseSchoolYear',
      method: 'get'
    });
  },
  findTchCoYearList: (params: ITchCoYearParams) => {
    return service({
      url: '/course/findTchCoYearList',
      method: 'get',
      params,
    });
  },
  findTchCoYear: (params: ITchCoYearParams) => {
    return service({
      url: '/course/findTchCoYear',
      method: 'get',
      params,
    });
  },

  findPage: (data: ICoursePageParams) => {
    return service({
      url: `/course/findPage`,
      method: 'post',
      data,
    });
  },
  save: (data: ICoSelectedParams) => {
    return service({
      url: `/course/save`,
      method: 'post',
      data,
    });
  },
  delete: (data: string[]) => {
    return service({
      url: `/course/deleteByIds`,
      method: 'delete',
      data,
    });
  },
  findOne: (params: ICourseOneParams) => {
    return service({
      url: `/course/findOne`,
      method: 'get',
      params,
    });
  },
  courseTable: (data: ICourseTableParams) => {
    return service({
      url: `/course/courseTable`,
      method: 'post',
      data,
    });
  },
  updateColor: (params: IUpadteCourseColorParams) => {
    return service({
      url: `/course/updateColor`,
      method: 'get',
      params,
    });
  },
  todayCourse: (data: ITodayCourseParams) => {
    return service({
      url: `/course/courseTable`,
      method: 'post',
      data,
    });
  },
  recover: (params: { courseId: string }) => {
    return service({
      url: `/course/recover`,
      method: 'get',
      params,
    });
  },
}